'use strict';

const Controller = require('egg').Controller;

class UserController extends Controller {
  async find() {
    const { ctx } = this;
    const userId = ctx.query.id;
    const userInfo = await ctx.service.user.find(userId);
    ctx.body = userInfo;
  }
  async set() {
    const { ctx } = this;
    const data = ctx.request.body;
    const res = await ctx.service.user.set(data);
    ctx.body = res;
  }
  async add() {
    const { ctx } = this;
    const data = ctx.request.body;
    const res = await ctx.service.user.add(data);
    ctx.body = res;
  }
  async del() {
    const { ctx } = this;
    const id = ctx.request.body.id;
    const res = await ctx.service.user.del(id);
    ctx.body = res;
  }
}
module.exports = UserController;
